Documentation > CMS Template API Library > Input > ShowDropDown(String,String,Dictionary[String,String],List[String],Int32,Boolean,String,String,Boolean)
ShowDropDown
Shows a drop down menu selector control.
public System.Void ShowDropDown(String,String,Dictionary[String,String],List[String],Int32,Boolean,String,String,Boolean)
Parameters
Name | Description | Type |
---|---|---|
label | The label of the field when displayed. | System.String |
fieldName | The field name where the value will be stored. | System.String |
entries | A list of key/value pairs that define the entries in the list. Key is the text that is displayed, value gets stored. | Dictionary<String,String> |
defaultValue | Optional: defaults to null. The list of default values that will appear selected when nothing has been selected. The size of this list can only be greater than 1 if and only if the optional parameter multiple is set to true. | List<String> |
size | Optional: Controls the width of the dropdown. Defaults to 250. Values need to be between 158 and 450. | System.Int32 |
multiple | Optional: defaults to false. Setting this optional parameter to true will allow multiple selections from the drop down menu. | System.Boolean |
helpMessage | Optional: help message | System.String |
popupMessage | Optional: The popup help message. | System.String |
alwaysSend | Optional: If true, the value of the field will always be sent from the frontend to the backend regardless of whether its state has changed. | System.Boolean |
Code Example
C#
Sample:
// The users will see Zero, One, and Two, but 0,1,2 will be stored as the value Dictionary<string,string> entries = new Dictionary<string, string>(){{"Zero","0"},{"One","1"},{"Two","2"}}; Input.ShowDropDown("Nested Drop Down", "nested_drop", entries); //The users will see English, French, Japanese, and Korean, but en, fr, jp, kr as the value Dictionary<string, string> languages = new Dictionary<string, string>() { { "English", "en" }, { "French", "fr" }, { "Japanese", "jp" }, { "Korean", "kr" } }; Input.ShowDropDown("Language Settings", "language_setting", languages, Util.MakeList("en", "jp"), languages.count, true);